#ifndef __parser_H__
#define __parser_H__

#include "language.h"
#include "syntax_entry.h"

namespace syntax_analysis
{
#define IN
#define OUT

	class parser
	{
	public:
		language* do_parser( char *code );

	protected:
		string parse_language_name( char* &code, int &line );
		string parse_language_entry( char* &code, int &line );
		syntax_entry* parse_entry( char* &code, int &line, language *lang );
		syntax_entry* parse_syntax_head( 
			char* &code, 
			int &line,
			OUT string &name, 
			OUT string &on_error,
			language *lang );
		syntax_compound* parse_compound( char* &code, int &line, language *lang, char stop_char );
		syntax_char* parse_char( char* &code, int &line );
		syntax_call* parse_call( char* &code, int &line, language *lang );
		syntax_attribute* parse_attr( char* &code, int &line );

	protected:
		void init();
		void take_space( char* &code, int &line );
		string parse_string( char* &code );
		string parse_symbol( char* &code );
		int parse_number( char* &code );

	private:
		int m_space[256];
		int m_symbol[256];
		int m_symbol_head[256];
	};
}

#endif // __parser_h__
